

module.exports = function deepClone(origin, target) {
    var target = target || {},
        toStr = Object.prototype.toString,
        arrType = '[object Array]';
    for (let key in origin) {
        //原型上的不拷贝
        if (origin.hasOwnProperty(key)) {
            //对象类型且非null
            if (typeof (origin[key]) === 'object' && origin[key] !== null) {
                toStr.call(origin[key]) === arrType ? target[key] = [] : target[key] = {};
                deepClone(origin[key], target[key]);
            } else { target[key] = origin[key] };
        }
    }
    return target;
}

